High Efficiency Video Coding (HEVC) is a new coding standard that has been developed in recent years. In the High Efficiency Video Coding (HEVC) system, the fixed-size macroblock of H.264/AVC is replaced by a flexible block, named coding unit (CU). Pixels in the CU share the same coding parameters to improve coding efficiency. A CU may begin with a largest CU (LCU), which is also referred as coded tree unit (CTU) in HEVC. In addition to the concept of coding unit, the concept of prediction unit (PU) is also introduced in HEVC. Once the splitting of CU hierarchical tree is done, each leaf CU is further split into one or more prediction units (PUs) according to prediction type and PU partition.
Along with the High Efficiency Video Coding (HEVC) standard development, the development of extensions of HEVC has also started. The HEVC extensions include range extensions (RExt) which target at non-4:2:0 color formats, such as 4:2:2 and 4:4:4, and higher bit-depths video such as 12, 14 and 16 bits per sample. One of the likely applications utilizing RExt is screen sharing, over wired- or wireless-connection. Due to specific characteristics of screen contents, coding tools have been developed and demonstrate significant gains in coding efficiency. Among them, the color index coding (a.k.a. major color based coding) techniques represent block of pixels using indices to the palette (major colors), and encode the palette and the indices by exploiting spatial redundancy. While the total number of possible color combinations is huge, the number of colors in an area of picture is usually very limited for typical screen contents. Therefore, the color index coding becomes very effective for screen content materials.
During the early development of HEVC range extensions (RExt), several proposals have been disclosed to address palette-based coding. For example, a palette prediction and sharing technique is disclosed in JCTVC-N0247 (Guo et al., “RCE3: Results of Test 3.1 on Palette Mode for Screen Content Coding”, Joint Collaborative Team on Video Coding (JCT-VC) of ITU-T SG 16 WP 3 and ISO/IEC JTC 1/SC 29/WG 11, 14th Meeting: Vienna, AT, 25 Jul.-2 Aug. 2013 Document: JCTVC-N0247) and JCTVC-O0218 (Guo et al., “Evaluation of Palette Mode Coding on HM-12.0+RExt-4.1”, Joint Collaborative Team on Video Coding (JCT-VC) of ITU-T SG 16 WP 3 and ISO/IEC JTC 1/SC 29/WG 11, 15th Meeting: Geneva, CH, 23 Oct.-1, Nov. 2013, Document: JCTVC-O0218). In JCTVC-N0247, the palette of each color component is constructed and transmitted. The palette can be predicted (or shared) from its left neighboring CU to reduce the bitrate. All pixels within the given block are then coded using their palette indices. An example of encoding process according to JCTVC-N0247 is shown as follows.                1. Transmission of the palette: the color index table size is first transmitted followed by the palette elements.        2. Transmission of pixel values: the pixels in the CU are encoded in a raster scan order. For each group of one or more pixels, a flag for a run-based mode is first transmitted to indicate whether the “run” mode or “copy above” mode is being used.                    2.1 “run” mode: In the “run” mode, a palette index is first signaled followed by “palette_run” (e.g., M) representing the run value. The run value indicates that a total of M samples are all coded using “run” mode. No further information needs to be transmitted for the current position and the following M positions since they have the same palette index as that signaled in the bitstream. The palette index (e.g., i) may also be shared by all three color components, which means that the reconstructed pixel values are (Y, U, V)=(paletteY[i], paletteU[i], paletteV[i]) for the case of YUV color space.            2.2 “copy above” mode: In the “copy above” mode, a value “copy_run” (e.g., N) is transmitted to indicate that for the following N positions (including the current one), the palette index is the same as the corresponding palette index in the row above.                        3. Transmission of residue: the palette indices transmitted in Stage 2 are converted back to pixel values and used as the prediction. Residue information is transmitted using HEVC residual coding and is added to the prediction for the reconstruction.        
In the original version of the work disclosed in JCTVC-N0247, palette of each component are constructed and transmitted. The palette can be predicted (shared) from its left neighboring CU to reduce the bitrate. In JCTVC-O0218, each element in the palette is a triplet, representing a specific combination of the three color components. The predictive coding of palette across CU is removed.
Yet another major color-base coding (color index coding) method is disclosed by Guo et al. in JCTVC-O0182 (Guo et al., “AHG8: Major-color-based screen content coding”, Joint Collaborative Team on Video Coding (JCT-VC) of ITU-T SG 16 WP 3 and ISO/IEC JTC 1/SC 29/WG 11, 15th Meeting: Geneva, CH, 23 Oct.-1, Nov. 2013, Document: JCTVC-O0182). According to JCTVC-O0182, the palette of each component are constructed and transmitted. However, instead of predicting the entire palette from the left CU, individual entry in a palette can be predicted from the exact corresponding palette entry in the above CU or left CU.
According to JCTVC-O0182, a predictive coding method is applied on the indices for transmission of pixel values, where a pixel line can be predicted by different modes. In specific, three kinds of line modes are used for a pixel line, i.e. horizontal mode, vertical mode and normal mode. In horizontal mode, all the pixels in the same line have the same value. If the value is the same as the first pixel of the above pixel line, only line mode signaling bits are transmitted. Otherwise, the index value is also transmitted. In vertical mode, the current pixel line is the same with the above pixel line. Therefore, only line mode signaling bits are transmitted. In normal mode, pixels in a line are predicted individually. For each pixel, the left or above neighboring pixel is used as predictor, and the prediction symbol is transmitted to the decoder. Furthermore, pixels are classified into major color pixels and escape pixels. For major color pixels, the decoder reconstructs the pixel values using the major color indices and palette. For escape pixels, the encoder will further send the pixel values.
Palette Size Signaling
In SCM-2.0 (Joshi et al., Screen content coding test model 2 (SCM 2), Joint Collaborative Team on Video Coding (JCT-VC) of ITU-T SG 16 WP3 and ISO/IEC JTC 1/SC29/WG11, 18th Meeting: Sapporo, JP, 30 Jun.-9 Jul. 2014, Document: JCTVC-R1014), the block vector (BV), an improved palette scheme has been included. The improved palette scheme is based on JCTVC-R0348 (Onno et al., Suggested combined software and text for run-based palette mode, Joint Collaborative Team on Video Coding (JCT-VC) of ITU-T SG 16 WP3 and ISO/IEC JTC 1/SC29/WG11, 18th Meeting: Sapporo, JP, 30 Jun.-9 Jul. 2014, Document: JCTVC-R0348). In SCM-2.0, the size of the palette is set as the size of the predicting palette and the size of the transmitted palette size. The predicting palette is a palette derived from the previously reconstructed palette coded CUs. When the current CU is coded as the palette mode, those palette colors that are not predicted by the predicting palette are directly transmitted in the bitstream. For example, if the current CU is coded as the palette mode with a palette size equal to six, three of the six major colors are predicted from the predicting palette and three are directly transmitted through the bitstream, the transmitted three can be signaled using the sample syntax as shown below.                palette_num_signalled_entries=3        for (cIdx=0; cIdx<NumComp; cIdx++)        for (i=0; i<palette_num_signalled_entries; i++)        palette_entries[cIdx][numPredPreviousPalette+i]        
Since the palette size is six in this example, the palette index from 0 to 5 is used to indicate each palette coded pixel that can be reconstructed as the major color in the palette color table. In the above pseudo codes, palette_num_signalled_entries indicates the number of entries being signaled. The first loop with loop index cIdex corresponds to the loop for each color component for NumComp color component. The second loop with loop index i corresponds to the loop for palette entries signaled.
In SCM-2.0, to indicate that a pixel is coded as an escape pixel, the color index for the escape pixel is signaled as the value equal to the palette size. When escape pixels is coded in a palette coded block, the palette size of that block can be increased by one and the last major color index can be used as the index of escape pixels according to one exemplary implementation. In the above example, the major color index six indicates that this pixel is an escape pixel. Moreover, in SCM-2.0, one CU-level escape flag, palette_escape_val_present_flag, is signaled for each palette CU to indicate whether escape pixels indexing is coded for this palette CU.
Removing the redundancy of the major color index is another coding tool in SCM-2.0, which also affects the palette size. When the left pixel is coded as normal mode with runs and the left pixel is not escape pixel, it can be assumed that current pixel is not equal to the major color index of the left pixel. Otherwise, the current pixel would be merged to the run coding of the left pixel. In another case, when the left pixel is coded in the run of copy-above mode and the above pixel is not an escape pixel, it can be assumed that current pixel is not equal to the major color index of the above pixel. Otherwise, the current pixel would be merged to the copy-above run coding of the left pixel. In SCM-2.0, in order to remove the redundancy in the above mentioned cases, the major color of the left pixel (or the major color of the above pixel) can be removed from the palette table when coding current pixel. In the cases, the palette size could be regarded as the original size decreased by one. Note that, when the left pixel is coded as copy-above mode and the above pixel is an escape pixel or when the left pixel is coded as run mode and the left pixel is an escape pixel, the value of the above/left pixel (i.e., escape index) cannot be removed from the palette color table for coding current pixel, and the palette size cannot be decreased by one.
According to existing color palette coding as described in HEVC range extensions (RExt), the palette size derived or received may be equal to 0. Since the cases of palette size being equal to 0 are meaningless, the issue of zero-size palette needs to be resolved to avoid possible system problem related to zero-size palette. It is desirable to develop methods to overcome the issues associated with the zero-size palette table.